home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / bro / BroShip1.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  36.4 KB  |  1,278 lines

  1. class classes.bro.BroShip1
  2. {
  3.    var tX;
  4.    var x;
  5.    var tY;
  6.    var y;
  7.    var clip;
  8.    var w;
  9.    var h;
  10.    var weapon;
  11.    var trans;
  12.    var colorTrans;
  13.    var colorVars;
  14.    var life;
  15.    var fireDir;
  16.    var shotX;
  17.    var shotY;
  18.    var dirXArray;
  19.    var dirYArray;
  20.    var dirX;
  21.    var dirY;
  22.    var destX;
  23.    var destY;
  24.    var xyMetFunction;
  25.    var handState;
  26.    var baseSpeed = 6;
  27.    var speed = 6;
  28.    var fire = false;
  29.    var d = 999989;
  30.    var c = 0;
  31.    var fc = 0;
  32.    var shotID = 0;
  33.    var xA = 0;
  34.    var yA = 0;
  35.    var f2 = "";
  36.    var facing = "R";
  37.    var hc = 0;
  38.    var fireFreq = 11;
  39.    var fireFreqOrig = 11;
  40.    var shieldOn = false;
  41.    var inv = false;
  42.    var control = true;
  43.    var exit = false;
  44.    var tagTeaming = false;
  45.    var bg = false;
  46.    var gesture = false;
  47.    var sl = "top";
  48.    var ofc = 0;
  49.    var endFire = false;
  50.    var hover = true;
  51.    function BroShip1(px, py)
  52.    {
  53.       this.tX = this.x = px;
  54.       this.tY = this.y = py;
  55.       this.clip = _root.attachMovie("broShip1","broShip1Clip",this.d);
  56.       this.w = this.clip._width;
  57.       this.h = this.clip._height;
  58.       this.clip._x = this.x;
  59.       this.clip._y = this.y;
  60.       this.weapon = _root.bro1Weapon;
  61.       this[this.weapon]();
  62.       this.trans = new flash.geom.Transform(this.clip);
  63.       this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
  64.       this.colorVars = new Object();
  65.       this.life = _root.bro1Life;
  66.       if(_root.bro1ShipVar == 1)
  67.       {
  68.          this.clip.body.shipStyles.gotoAndStop(_root.bro1ShipLevel);
  69.          if(_root.level == 1 && _root.shipPass && (_root.bro1ShipLevel == 2 || _root.bro1ShipLevel == 3) || _root.level == 2 && _root.bro1ShipLevel == 3)
  70.          {
  71.             _root.audio.playLevel2("tagTeam1",20);
  72.             this.colorFlash(255,255,255,30);
  73.             _root.shipPass = false;
  74.          }
  75.       }
  76.       else
  77.       {
  78.          this.clip.body.shipStyles.gotoAndStop(_root.bro1ShipVar);
  79.       }
  80.       var _loc3_ = _root.bro1ShipLevel <= 3 ? 1 + (_root.bro1ShipLevel - 1) * 2 : 1 + (_root.bro1ShipLevel - 4) * 2;
  81.       this.baseSpeed = this.speed = 5 + _loc3_;
  82.    }
  83.    function colorFlash(r, g, b, cMax)
  84.    {
  85.       this.colorVars.c = 0;
  86.       this.colorVars.r = r;
  87.       this.colorVars.g = g;
  88.       this.colorVars.b = b;
  89.       this.colorVars.cMax = cMax;
  90.       this.colorVars.flashing = true;
  91.    }
  92.    function nudge(pxA, pyA, pscale)
  93.    {
  94.       if((this.c == 0 || this.c > 5) && !this.inv)
  95.       {
  96.          this.c = 0;
  97.          var _loc2_ = pscale / 150;
  98.          this.xA = pxA * _loc2_;
  99.          this.yA = pyA * _loc2_;
  100.          this.f2 = "nudging";
  101.       }
  102.    }
  103.    function nudging()
  104.    {
  105.       this.xA *= 0.75;
  106.       this.yA *= 0.75;
  107.       this.c = this.c + 1;
  108.       if(this.c == 20)
  109.       {
  110.          this.xA = this.yA = 0;
  111.          this.f2 = "";
  112.          this.c = 0;
  113.       }
  114.    }
  115.    function powerUp(type)
  116.    {
  117.       if(type.substr(0,10) == "speedBoost")
  118.       {
  119.          var _loc3_ = Number(type.substr(10));
  120.          this.speedBoost(_loc3_ * 300);
  121.       }
  122.       else if(type.substr(0,11) == "weaponBoost")
  123.       {
  124.          _loc3_ = Number(type.substr(11));
  125.          this.weaponBoost(_loc3_ * 200);
  126.       }
  127.       else
  128.       {
  129.          this[type]();
  130.       }
  131.    }
  132.    function coin1()
  133.    {
  134.       _root.coins.addTo(1);
  135.       this.colorFlash(200,200,200,10);
  136.    }
  137.    function coin5()
  138.    {
  139.       _root.coins.addTo(5);
  140.       this.colorFlash(200,200,200,10);
  141.    }
  142.    function coin10()
  143.    {
  144.       _root.coins.addTo(10);
  145.       this.colorFlash(200,200,0,10);
  146.    }
  147.    function coin25()
  148.    {
  149.       _root.coins.addTo(25);
  150.       this.colorFlash(200,200,0,10);
  151.    }
  152.    function stealCoins(num)
  153.    {
  154.       if(!this.shieldOn && !this.inv)
  155.       {
  156.          _root.audio.playLevel2("coinDrain2",25);
  157.          var _loc4_ = random(num) + 2;
  158.          if(_root.coins.num - _loc4_ < 0)
  159.          {
  160.             _loc4_ = _root.coins.num;
  161.          }
  162.          _root.coins.addTo(-1 * _loc4_);
  163.          var _loc3_ = 0;
  164.          while(_loc3_ < _loc4_)
  165.          {
  166.             _root.fxID = _root.fxID + 1;
  167.             _root["coinDrain" + _root.fxID] = new classes.fx.CoinDrain(this.x + 6,this.y + 6,_root.fxID);
  168.             _root.addFX("coinDrain" + _root.fxID);
  169.             _loc3_ = _loc3_ + 1;
  170.          }
  171.       }
  172.    }
  173.    function gem1()
  174.    {
  175.       _root.gems.addTo(1);
  176.       this.colorFlash(40,255,180,15);
  177.    }
  178.    function gem2()
  179.    {
  180.       _root.gems.addTo(1);
  181.       this.colorFlash(0,90,200,15);
  182.    }
  183.    function gem3()
  184.    {
  185.       _root.gems.addTo(1);
  186.       this.colorFlash(255,50,0,15);
  187.    }
  188.    function gem4()
  189.    {
  190.       _root.gems.addTo(1);
  191.       this.colorFlash(255,170,30,15);
  192.    }
  193.    function gem5()
  194.    {
  195.       _root.gems.addTo(1);
  196.       this.colorFlash(255,100,255,15);
  197.    }
  198.    function gem6()
  199.    {
  200.       _root.gems.addTo(1);
  201.       this.colorFlash(0,255,180,15);
  202.    }
  203.    function smartBomb()
  204.    {
  205.       _root.smartBomb.gotoAndPlay(2);
  206.       var _loc2_ = 1;
  207.       var _loc3_ = _root.chars.length;
  208.       var _loc4_ = _root.chars.slice();
  209.       while(_loc2_ < _loc3_)
  210.       {
  211.          _root[_loc4_[_loc2_]].bombed(20);
  212.          _loc2_ = _loc2_ + 1;
  213.       }
  214.       _loc2_ = 0;
  215.       _loc3_ = _root.enemyShots.length;
  216.       _loc4_ = _root.enemyShots.slice();
  217.       while(_loc2_ < _loc3_)
  218.       {
  219.          _root[_loc4_[_loc2_]].bombed();
  220.          _loc2_ = _loc2_ + 1;
  221.       }
  222.       _loc2_ = 0;
  223.       _loc3_ = _root.FX.length;
  224.       _loc4_ = _root.FX.slice();
  225.       while(_loc2_ < _loc3_)
  226.       {
  227.          _root[_loc4_[_loc2_]].bombed();
  228.          _loc2_ = _loc2_ + 1;
  229.       }
  230.    }
  231.    function superP()
  232.    {
  233.       this.weaponBoost(600);
  234.       this.speedBoost(600);
  235.       this.shield();
  236.    }
  237.    function shield()
  238.    {
  239.       if(!this.shieldOn)
  240.       {
  241.          _root.shield = new classes.misc.Shield();
  242.          _root.addPowerUp("shield");
  243.          this.shieldOn = true;
  244.       }
  245.       else if(_root.shield.out)
  246.       {
  247.          _root.shield.renew();
  248.       }
  249.       this.colorFlash(70,180,250,30);
  250.    }
  251.    function rampage()
  252.    {
  253.       var _loc2_ = 0;
  254.       var _loc3_ = _root.powerUps.length;
  255.       while(_loc2_ < _loc3_)
  256.       {
  257.          if(_root.powerUps[_loc2_] == "rampage")
  258.          {
  259.             _root.removePowerUp("rampage");
  260.             break;
  261.          }
  262.          _loc2_ = _loc2_ + 1;
  263.       }
  264.       _root.rampage = new classes.misc.Rampage(300);
  265.       _root.addPowerUp("rampage");
  266.    }
  267.    function weaponBoost(num)
  268.    {
  269.       if(this.weapon == "laserA" || this.weapon == "doubleLaserA" || this.weapon == "tripleLaserA" || this.weapon == "bigLaser" || this.weapon == "twistLaser" || this.weapon == "tripleTwistLaser")
  270.       {
  271.          if(_root.currentBoost == "rapidFire")
  272.          {
  273.             _root.removePowerUp("rapidFire");
  274.          }
  275.          _root.currentBoost = "rapidFire";
  276.          this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
  277.          if(this.weapon != "bigLaser")
  278.          {
  279.             _root.rapidFire = new classes.misc.RapidFire(num,false);
  280.          }
  281.          else
  282.          {
  283.             _root.rapidFire = new classes.misc.RapidFire(num,true);
  284.          }
  285.          _root.addPowerUp("rapidFire");
  286.       }
  287.       if(this.weapon == "rapidLaser" || this.weapon == "doubleRapidLaser")
  288.       {
  289.          if(_root.currentBoost == "laserBoost")
  290.          {
  291.             _root.removePowerUp("laserBoost");
  292.          }
  293.          _root.currentBoost = "laserBoost";
  294.          this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
  295.          _root.laserBoost = new classes.misc.LaserBoost(num);
  296.          _root.addPowerUp("laserBoost");
  297.       }
  298.       if(this.weapon == "superLaser")
  299.       {
  300.          if(_root.currentBoost == "superRapidFire")
  301.          {
  302.             _root.removePowerUp("superRapidFire");
  303.          }
  304.          _root.currentBoost = "superRapidFire";
  305.          this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
  306.          _root.superRapidFire = new classes.misc.SuperRapidFire(num);
  307.          _root.addPowerUp("superRapidFire");
  308.       }
  309.       this.colorFlash(255,125,0,30);
  310.    }
  311.    function checkBoost()
  312.    {
  313.       if(_root.currentBoost != "")
  314.       {
  315.          _root.removePowerUp(_root.currentBoost);
  316.          _root.currentBoost = "";
  317.          _root.laserPower = 8;
  318.       }
  319.    }
  320.    function doubleLaserA()
  321.    {
  322.       this.checkBoost();
  323.       _root.rapidVar = 4;
  324.       this.fireFreq = 11;
  325.       this.fireFreqOrig = 11;
  326.       _root.bro1Weapon = this.weapon = "doubleLaserA";
  327.       this.colorFlash(200,200,0,30);
  328.    }
  329.    function twistLaser()
  330.    {
  331.       this.checkBoost();
  332.       _root.rapidVar = 4;
  333.       this.fireFreq = 10;
  334.       this.fireFreqOrig = 10;
  335.       _root.bro1Weapon = this.weapon = "twistLaser";
  336.       this.colorFlash(255,160,0,30);
  337.    }
  338.    function tripleTwistLaser()
  339.    {
  340.       this.checkBoost();
  341.       _root.rapidVar = 4;
  342.       this.fireFreq = 10;
  343.       this.fireFreqOrig = 10;
  344.       _root.bro1Weapon = this.weapon = "tripleTwistLaser";
  345.       this.colorFlash(100,200,230,30);
  346.    }
  347.    function tripleLaserA()
  348.    {
  349.       this.checkBoost();
  350.       _root.rapidVar = 4;
  351.       this.fireFreq = 11;
  352.       this.fireFreqOrig = 11;
  353.       _root.bro1Weapon = this.weapon = "tripleLaserA";
  354.       this.colorFlash(0,200,230,30);
  355.    }
  356.    function rapidLaser()
  357.    {
  358.       this.checkBoost();
  359.       _root.rapidVar = 2;
  360.       this.fireFreq = 4;
  361.       this.fireFreqOrig = 4;
  362.       _root.bro1Weapon = this.weapon = "rapidLaser";
  363.       this.colorFlash(0,230,190,30);
  364.    }
  365.    function bigLaser()
  366.    {
  367.       this.checkBoost();
  368.       _root.rapidVar = 4;
  369.       this.fireFreq = 9;
  370.       this.fireFreqOrig = 9;
  371.       _root.bro1Weapon = this.weapon = "bigLaser";
  372.       this.colorFlash(0,130,255,30);
  373.    }
  374.    function superLaser()
  375.    {
  376.       this.checkBoost();
  377.       _root.rapidVar = 3;
  378.       this.fireFreq = 5;
  379.       this.fireFreqOrig = 5;
  380.       _root.bro1Weapon = this.weapon = "superLaser";
  381.       this.colorFlash(255,255,255,30);
  382.    }
  383.    function lifeUp()
  384.    {
  385.       if(this.life + 25 > 100)
  386.       {
  387.          _root.lifeMeter.adjust(this.life,100 - this.life);
  388.          this.life = 100;
  389.       }
  390.       else
  391.       {
  392.          _root.lifeMeter.adjust(this.life,25);
  393.          this.life += 25;
  394.       }
  395.       this.colorFlash(255,75,255,30);
  396.    }
  397.    function lifeMax()
  398.    {
  399.       _root.lifeMeter.adjust(this.life,100 - this.life);
  400.       this.life = 100;
  401.       this.colorFlash(255,0,0,30);
  402.    }
  403.    function speedBoost(num)
  404.    {
  405.       var _loc3_ = 0;
  406.       var _loc4_ = _root.powerUps.length;
  407.       while(_loc3_ < _loc4_)
  408.       {
  409.          if(_root.powerUps[_loc3_] == "speedBoost")
  410.          {
  411.             _root.removePowerUp("speedBoost");
  412.             break;
  413.          }
  414.          _loc3_ = _loc3_ + 1;
  415.       }
  416.       _root.speedBoost = new classes.misc.SpeedBoost(num);
  417.       _root.addPowerUp("speedBoost");
  418.       this.colorFlash(0,255,0,60);
  419.    }
  420.    function hit(pxMov, pyMov, pscale, ppower)
  421.    {
  422.       var _loc7_ = pxMov;
  423.       var _loc8_ = pyMov;
  424.       var _loc9_ = pscale;
  425.       var _loc4_ = _root.bro1ShipLevel <= 3 ? 1 - (_root.bro1ShipLevel - 1) * 0.2 : 1 - (_root.bro1ShipLevel - 4) * 0.2;
  426.       if(_root.bro1ShipVar == 3)
  427.       {
  428.          _loc4_ = 0.5;
  429.       }
  430.       var _loc5_ = ppower * _loc4_;
  431.       if(this.shieldOn && !this.inv)
  432.       {
  433.          _root.shield.hit();
  434.       }
  435.       else if(!this.inv)
  436.       {
  437.          var _loc6_ = this.life;
  438.          this.life -= _loc5_;
  439.          if(this.life < 1)
  440.          {
  441.             _root.bro1Life = 0;
  442.             _root.audio.playLevel2("broShip1X",_root.randRange(30,40));
  443.             this.inv = true;
  444.             this.clip.gun._visible = false;
  445.             this.clip.fx._visible = false;
  446.             this.colorTrans.redOffset = 0;
  447.             this.colorTrans.greenOffset = 0;
  448.             this.colorTrans.blueOffset = 0;
  449.             this.trans.colorTransform = this.colorTrans;
  450.             this.clip.body.gotoAndPlay("explode");
  451.             this.control = false;
  452.             this.facing = "switch";
  453.             this.fireDir = "";
  454.             var _loc3_ = 0;
  455.             while(_loc3_ < 5)
  456.             {
  457.                if(_root.bro1ShipVar == 1)
  458.                {
  459.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"BroShip1_" + _root.bro1ShipLevel]);
  460.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"broShip1B_" + _root.bro1ShipLevel]);
  461.                }
  462.                else if(_root.bro1ShipVar == 7)
  463.                {
  464.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"BroShipBlack"]);
  465.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"broShipBlackB"]);
  466.                }
  467.                else
  468.                {
  469.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"BroShip1_3B"]);
  470.                   _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"broShip1B_3B"]);
  471.                }
  472.                _loc3_ = _loc3_ + 1;
  473.             }
  474.             _root.bro1ShipVar = 1;
  475.          }
  476.          else
  477.          {
  478.             _root.lifeMeter.adjust(_loc6_,-1 * _loc5_);
  479.             this.nudge(_loc7_,_loc8_,_loc9_);
  480.             this.inv = true;
  481.             this.colorFlash(255,0,0,20);
  482.             _root.audio.playLevel3("broHit" + (random(3) + 1),_root.randRange(7,14));
  483.          }
  484.       }
  485.    }
  486.    function explosion()
  487.    {
  488.       _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-70,70),this.y + this.clip._height / 2 + _root.randRange(-70,70),_root.randRange(50,140),_root.randRange(70,100)]);
  489.    }
  490.    function shipToJetPack()
  491.    {
  492.       _root.bro1 = new classes.bro.Bro1(this.x + 6,this.y + 3);
  493.       _root.addChar("bro1");
  494.       _root.char = "bro1";
  495.       _root.shield = new classes.misc.Shield();
  496.       _root.addPowerUp("shield");
  497.       _root[_root.char].shieldOn = true;
  498.       if(_root.lastBoss && _root.char2 == "broShip2")
  499.       {
  500.          var _loc3_ = this.x >= 500 ? -50 : 1020;
  501.          var _loc4_ = this.x >= 500 ? "R" : "L";
  502.          _root.broShip2 = new classes.bro.BroShip2(_loc3_,280);
  503.          _root.addChar("broShip2");
  504.          _root.broShip2.tagTeam(_loc4_);
  505.       }
  506.       else if(_root.char2 == "broShip2" && !_root.broShip2.tagTeaming)
  507.       {
  508.          _root.rescue = true;
  509.          if(!_root.boss && !_root.broShip2.bg)
  510.          {
  511.             _root.broAction([7]);
  512.          }
  513.       }
  514.    }
  515.    function removeShip()
  516.    {
  517.       _root.removeChar("broShip1");
  518.    }
  519.    function fire_laserA()
  520.    {
  521.       _root.audio.playLevel5("laserA" + (random(5) + 1),random(4) + 6);
  522.       this.shotID = this.shotID + 1;
  523.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX,this.shotY,this.fireDir,this.shotID);
  524.       _root.addBroShot("laserA" + this.shotID);
  525.       this.clip.gun.blast.gotoAndPlay("go");
  526.    }
  527.    function fire_doubleLaserA()
  528.    {
  529.       _root.audio.playLevel5("doubleLaserA" + (random(5) + 1),random(10) + 8);
  530.       if(this.fireDir == "R" || this.fireDir == "L")
  531.       {
  532.          var _loc6_ = 0;
  533.          var _loc4_ = -6;
  534.          var _loc5_ = 0;
  535.          var _loc3_ = 6;
  536.       }
  537.       else
  538.       {
  539.          _loc6_ = -6;
  540.          _loc4_ = 0;
  541.          _loc5_ = 6;
  542.          _loc3_ = 0;
  543.       }
  544.       this.shotID = this.shotID + 1;
  545.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,this.shotID);
  546.       _root.addBroShot("laserA" + this.shotID);
  547.       this.shotID = this.shotID + 1;
  548.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,this.shotID);
  549.       _root.addBroShot("laserA" + this.shotID);
  550.       this.clip.gun.blast.gotoAndPlay("go");
  551.    }
  552.    function fire_twistLaser()
  553.    {
  554.       _root.audio.playLevel5("twist" + (random(3) + 1),random(10) + 8);
  555.       this.shotID = this.shotID + 1;
  556.       _root["twistLaser" + this.shotID] = new classes.bro.TwistLaser(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
  557.       _root.addBroShot("twistLaser" + this.shotID);
  558.       this.shotID = this.shotID + 1;
  559.       _root["twistLaser" + this.shotID] = new classes.bro.TwistLaser(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
  560.       _root.addBroShot("twistLaser" + this.shotID);
  561.       this.clip.gun.blast.gotoAndPlay("go");
  562.    }
  563.    function fire_tripleTwistLaser()
  564.    {
  565.       _root.audio.playLevel5("twist" + (random(3) + 1),random(10) + 8);
  566.       this.shotID = this.shotID + 1;
  567.       _root["twistLaserB" + this.shotID] = new classes.bro.TwistLaserB(this.shotX,this.shotY,this.fireDir,this.shotID);
  568.       _root.addBroShot("twistLaserB" + this.shotID);
  569.       this.shotID = this.shotID + 1;
  570.       _root["twistLaserC" + this.shotID] = new classes.bro.TwistLaserC(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
  571.       _root.addBroShot("twistLaserC" + this.shotID);
  572.       this.shotID = this.shotID + 1;
  573.       _root["twistLaserC" + this.shotID] = new classes.bro.TwistLaserC(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
  574.       _root.addBroShot("twistLaserC" + this.shotID);
  575.       this.clip.gun.blast.gotoAndPlay("go");
  576.    }
  577.    function fire_tripleLaserA()
  578.    {
  579.       _root.audio.playLevel5("tripleLaserA" + (random(5) + 1),random(10) + 8);
  580.       if(this.fireDir == "R" || this.fireDir == "L")
  581.       {
  582.          var _loc6_ = 0;
  583.          var _loc4_ = -3;
  584.          var _loc5_ = 0;
  585.          var _loc3_ = 3;
  586.       }
  587.       else
  588.       {
  589.          _loc6_ = -3;
  590.          _loc4_ = 0;
  591.          _loc5_ = 3;
  592.          _loc3_ = 0;
  593.       }
  594.       this.shotID = this.shotID + 1;
  595.       _root["spreadLaserA" + this.shotID] = new classes.bro.SpreadLaserA(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,1,this.shotID);
  596.       _root.addBroShot("spreadLaserA" + this.shotID);
  597.       this.shotID = this.shotID + 1;
  598.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX,this.shotY,this.fireDir,this.shotID);
  599.       _root.addBroShot("laserA" + this.shotID);
  600.       this.shotID = this.shotID + 1;
  601.       _root["spreadLaserA" + this.shotID] = new classes.bro.SpreadLaserA(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,2,this.shotID);
  602.       _root.addBroShot("spreadLaserA" + this.shotID);
  603.       this.clip.gun.blast.gotoAndPlay("go");
  604.    }
  605.    function fire_rapidLaser()
  606.    {
  607.       if(this.fireDir == "R" || this.fireDir == "L")
  608.       {
  609.          var _loc6_ = 0;
  610.          var _loc4_ = -6;
  611.          var _loc5_ = 0;
  612.          var _loc3_ = 6;
  613.       }
  614.       else
  615.       {
  616.          _loc6_ = -6;
  617.          _loc4_ = 0;
  618.          _loc5_ = 6;
  619.          _loc3_ = 0;
  620.       }
  621.       _root.audio.playLevel5("rapidLaser" + (random(5) + 1),random(30) + 10);
  622.       this.shotID = this.shotID + 1;
  623.       _root["rapidLaser" + this.shotID] = new classes.bro.RapidLaser(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,this.shotID);
  624.       _root.addBroShot("rapidLaser" + this.shotID);
  625.       this.shotID = this.shotID + 1;
  626.       _root["rapidLaser" + this.shotID] = new classes.bro.RapidLaser(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,this.shotID);
  627.       _root.addBroShot("rapidLaser" + this.shotID);
  628.       this.clip.gun.blast.gotoAndPlay("go");
  629.    }
  630.    function fire_bigLaser()
  631.    {
  632.       _root.audio.playLevel5("bigLaser" + (random(3) + 1),random(10) + 8);
  633.       this.shotID = this.shotID + 1;
  634.       _root["bigLaser" + this.shotID] = new classes.bro.BigLaser(this.shotX,this.shotY,this.fireDir,this.shotID);
  635.       _root.addBroShot("bigLaser" + this.shotID);
  636.       this.clip.gun.blast.gotoAndPlay("go2");
  637.       if(this.fireDir == "U")
  638.       {
  639.          this.nudge(0,2,100);
  640.       }
  641.       else if(this.fireDir == "D")
  642.       {
  643.          this.nudge(0,-2,100);
  644.       }
  645.       else if(this.fireDir == "L")
  646.       {
  647.          this.nudge(2,0,100);
  648.       }
  649.       else
  650.       {
  651.          this.nudge(-2,0,100);
  652.       }
  653.    }
  654.    function fire_superLaser()
  655.    {
  656.       _root.audio.playLevel5("superLaser" + (random(3) + 1),random(10) + 8);
  657.       if(this.sl == "top")
  658.       {
  659.          this.sl = "bot";
  660.          if(this.fireDir == "R" || this.fireDir == "L")
  661.          {
  662.             var _loc4_ = 0;
  663.             var _loc3_ = 6;
  664.          }
  665.          else
  666.          {
  667.             _loc4_ = 6;
  668.             _loc3_ = 0;
  669.          }
  670.       }
  671.       else
  672.       {
  673.          this.sl = "top";
  674.          if(this.fireDir == "R" || this.fireDir == "L")
  675.          {
  676.             _loc4_ = 0;
  677.             _loc3_ = -6;
  678.          }
  679.          else
  680.          {
  681.             _loc4_ = -6;
  682.             _loc3_ = 0;
  683.          }
  684.       }
  685.       this.shotID = this.shotID + 1;
  686.       _root["superLaserA" + this.shotID] = new classes.bro.SuperLaserA(this.shotX + _loc4_,this.shotY + _loc3_,this.fireDir,this.shotID);
  687.       _root.addBroShot("superLaserA" + this.shotID);
  688.       this.shotID = this.shotID + 1;
  689.       _root["superLaserB" + this.shotID] = new classes.bro.SuperLaserB(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
  690.       _root.addBroShot("superLaserB" + this.shotID);
  691.       this.shotID = this.shotID + 1;
  692.       _root["superLaserB" + this.shotID] = new classes.bro.SuperLaserB(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
  693.       _root.addBroShot("superLaserB" + this.shotID);
  694.       this.clip.gun.blast.gotoAndPlay("go2");
  695.       if(this.fireDir == "U")
  696.       {
  697.          this.nudge(0,2,100);
  698.       }
  699.       else if(this.fireDir == "D")
  700.       {
  701.          this.nudge(0,-2,100);
  702.       }
  703.       else if(this.fireDir == "L")
  704.       {
  705.          this.nudge(2,0,100);
  706.       }
  707.       else
  708.       {
  709.          this.nudge(-2,0,100);
  710.       }
  711.    }
  712.    function action1()
  713.    {
  714.       this.control = false;
  715.       this.dirXArray = ["L"];
  716.       this.dirYArray = ["","","U","U","D"];
  717.       this.changeDir();
  718.       this.f2 = "wander";
  719.       this.fireDir = "";
  720.    }
  721.    function action2()
  722.    {
  723.       this.gotoXY(0,80,"action2B");
  724.       this.dirX = "";
  725.    }
  726.    function action2B()
  727.    {
  728.       this.fireDir = "R";
  729.    }
  730.    function action3()
  731.    {
  732.       this.dirXArray = ["R"];
  733.       this.dirYArray = ["","U","D","D"];
  734.       this.changeDir();
  735.       this.f2 = "wander";
  736.       this.fireDir = "";
  737.    }
  738.    function action4()
  739.    {
  740.       this.gotoXY(0,150,"action4B");
  741.       this.dirX = "L";
  742.       this.clip.gotoAndPlay("faceLfireL");
  743.       this.fireDir = "L";
  744.       this.exit = true;
  745.    }
  746.    function action4B()
  747.    {
  748.       this.dirX = "L";
  749.       this.fireDir = "";
  750.    }
  751.    function action5()
  752.    {
  753.       this.goBG();
  754.       this.gotoXY(260,0,"action5B");
  755.    }
  756.    function goBG()
  757.    {
  758.       this.clip.swapDepths(9880);
  759.       this.bg = true;
  760.       this.control = false;
  761.       this.exit = true;
  762.       this.speed *= 0.8;
  763.       this.colorTrans.redOffset = -60;
  764.       this.colorTrans.greenOffset = -60;
  765.       this.colorTrans.blueOffset = -60;
  766.       this.trans.colorTransform = this.colorTrans;
  767.       this.clip._xscale = 66;
  768.       this.clip._yscale = 66;
  769.       this.fireDir = "";
  770.    }
  771.    function action5B()
  772.    {
  773.       this.gotoXY(0,800);
  774.    }
  775.    function action7()
  776.    {
  777.       this.goBG();
  778.       this.facing = _root["advanceDir" + _root.level];
  779.       if(_root["advanceDir" + _root.level] == "L")
  780.       {
  781.          this.gotoXY(-300,0);
  782.       }
  783.       else
  784.       {
  785.          this.gotoXY(1300,0);
  786.       }
  787.    }
  788.    function action11()
  789.    {
  790.       this.exit = true;
  791.       this.facing = "L";
  792.       this.gotoXY(-300,0);
  793.    }
  794.    function warpLeave()
  795.    {
  796.       this.control = false;
  797.       this.exit = true;
  798.       this.fireDir = "";
  799.       this.facing = "R";
  800.       this.gotoXY(1300,0);
  801.    }
  802.    function endPos()
  803.    {
  804.       this.xA = this.yA = 0;
  805.       this.speed = 2;
  806.       this.control = false;
  807.       this.facing = "R";
  808.       this.fireDir = "";
  809.       this.gotoXY(549,250);
  810.    }
  811.    function endPos2()
  812.    {
  813.       this.xA = this.yA = 0;
  814.       this.clip._x = this.x = this.tX = 549;
  815.       this.gotoXY(0,435,"endPos3");
  816.    }
  817.    function endPos3()
  818.    {
  819.       this.xA = this.yA = this.speed = 0;
  820.       this.gesture = true;
  821.       this.f2 = "";
  822.       this.clip._x = this.x = this.tX = 549;
  823.       this.clip._y = this.y = this.tY = 435;
  824.       this.hover = false;
  825.       this.clip.body.gotoAndPlay("endOpen");
  826.    }
  827.    function finalFunction()
  828.    {
  829.       _root.endBGClip.clip.zapShip._visible = true;
  830.       _root.endBGClip.clip.zapShip.play();
  831.    }
  832.    function endSeq(pdir)
  833.    {
  834.       this.tagTeaming = false;
  835.       this.speed = this.baseSpeed = 7;
  836.       this.exit = true;
  837.       this.weapon = "rapidLaser";
  838.       _root.bro1weapon = this.weapon;
  839.       this[this.weapon]();
  840.       this.facing = this.fireDir = pdir;
  841.       this.control = false;
  842.       var _loc3_ = this.facing != "L" ? 200 : 800;
  843.       this.gotoXY(_loc3_,280);
  844.    }
  845.    function endSeqB()
  846.    {
  847.       this.gotoXY(0,_root.deathHeadClip._y);
  848.    }
  849.    function endSeqMove()
  850.    {
  851.       this.speed = this.baseSpeed = 10;
  852.       this.endFire = true;
  853.       this.gotoXY(_root.randRange(100,900),_root.randRange(100,500),"endSeqMove");
  854.    }
  855.    function endStill()
  856.    {
  857.       this.endFire = false;
  858.       this.dirX = this.dirY = this.fireDir = "";
  859.       this.f2 = "";
  860.    }
  861.    function appear()
  862.    {
  863.       this.life += _root.randRange(35,50);
  864.       if(this.life > 100)
  865.       {
  866.          this.life = 100;
  867.       }
  868.       this.inv = true;
  869.       this.control = false;
  870.       this.exit = true;
  871.       if(this.x < 0)
  872.       {
  873.          this.facing = "R";
  874.          this.fireDir = "R";
  875.          this.gotoXY(150,0,"giveControl");
  876.       }
  877.       else
  878.       {
  879.          this.facing = "L";
  880.          this.fireDir = "L";
  881.          this.gotoXY(850,0,"giveControl");
  882.       }
  883.    }
  884.    function giveControl()
  885.    {
  886.       this.inv = false;
  887.       this.control = true;
  888.       this.exit = false;
  889.    }
  890.    function tagTeam(pdir)
  891.    {
  892.       this.speed *= 0.8;
  893.       var _loc3_ = pdir;
  894.       this.life += _root.randRange(25,50);
  895.       if(this.life > 100)
  896.       {
  897.          this.life = 100;
  898.       }
  899.       this.inv = true;
  900.       this.control = false;
  901.       this.exit = true;
  902.       this.tagTeaming = true;
  903.       this.facing = _loc3_;
  904.       if(this.facing == "R")
  905.       {
  906.          this.gotoXY(1300,0);
  907.       }
  908.       else
  909.       {
  910.          this.gotoXY(-300,0);
  911.       }
  912.    }
  913.    function getOut()
  914.    {
  915.       this.facing = "L";
  916.       this.fireDir = "";
  917.       this.exit = true;
  918.       this.gotoXY(-300,0,"",true);
  919.    }
  920.    function wave()
  921.    {
  922.       this.gesture = true;
  923.       this.clip.body.gotoAndPlay("wave");
  924.    }
  925.    function reanimate()
  926.    {
  927.       this.gesture = true;
  928.       this.clip.body.gotoAndPlay("reanimate");
  929.    }
  930.    function positionForSwitch(pdestX)
  931.    {
  932.       this.control = false;
  933.       this.gotoXY(pdestX,0,"action6B");
  934.       this.fireDir = "";
  935.       this.facing = "R";
  936.    }
  937.    function action6B()
  938.    {
  939.       this.gotoXY(0,_root.newShipClip._y);
  940.       this.facing = "switch";
  941.    }
  942.    function shipUpgrade(shipType)
  943.    {
  944.       this.control = false;
  945.       this.life = 100;
  946.       if(shipType == "ship2")
  947.       {
  948.          this.speed = this.baseSpeed = 8;
  949.          _root.bro1ShipLevel = 2;
  950.          this.clip.body.shipStyles.gotoAndStop(2);
  951.          this.clip.body.gotoAndPlay("close");
  952.       }
  953.       else if(shipType == "ship3")
  954.       {
  955.          this.speed = this.baseSpeed = 10;
  956.          _root.bro1ShipLevel = 3;
  957.          this.clip.body.shipStyles.gotoAndStop(3);
  958.          this.clip.body.gotoAndPlay("close");
  959.       }
  960.       else
  961.       {
  962.          this.speed = this.baseSpeed = 10;
  963.          _root.bro1ShipLevel = 3;
  964.          _root.bro1ShipVar = 3;
  965.          this.clip.body.shipStyles.gotoAndStop(8);
  966.          this.clip.body.gotoAndPlay("close");
  967.       }
  968.    }
  969.    function gotoXY(pdestX, pdestY, pmetFunction, pwave)
  970.    {
  971.       this.destX = pdestX;
  972.       this.destY = pdestY;
  973.       this.xyMetFunction = pmetFunction;
  974.       var _loc2_ = pwave;
  975.       if(this.destX != 0)
  976.       {
  977.          this.dirX = this.x <= this.destX ? "R" : "L";
  978.       }
  979.       if(this.destY != 0)
  980.       {
  981.          this.dirY = this.y <= this.destY ? "D" : "U";
  982.       }
  983.       this.f2 = "goingXY";
  984.       if(_loc2_)
  985.       {
  986.          this.wave();
  987.       }
  988.    }
  989.    function goingXY()
  990.    {
  991.       if(this.destX != 0 && Math.abs(this.x - this.destX) < this.speed + 1)
  992.       {
  993.          this.dirX = "";
  994.          var _loc2_ = true;
  995.       }
  996.       if(this.destX == 0)
  997.       {
  998.          _loc2_ = true;
  999.       }
  1000.       if(this.destY != 0 && Math.abs(this.y - this.destY) < this.speed + 1)
  1001.       {
  1002.          this.dirY = "";
  1003.          var _loc3_ = true;
  1004.       }
  1005.       if(this.destY == 0)
  1006.       {
  1007.          _loc3_ = true;
  1008.       }
  1009.       if(_loc2_ && _loc3_)
  1010.       {
  1011.          this[this.xyMetFunction]();
  1012.       }
  1013.    }
  1014.    function changeDir()
  1015.    {
  1016.       this.dirX = this.dirXArray[random(this.dirXArray.length)];
  1017.       this.dirY = this.dirYArray[random(this.dirYArray.length)];
  1018.    }
  1019.    function wander()
  1020.    {
  1021.       if(random(100) > 93)
  1022.       {
  1023.          this.changeDir();
  1024.       }
  1025.    }
  1026.    function main()
  1027.    {
  1028.       this[this.f2]();
  1029.       if(this.endFire)
  1030.       {
  1031.          if(random(30) == 0)
  1032.          {
  1033.             var _loc4_ = ["L","R","D","U","","","",""];
  1034.             this.fireDir = _loc4_[random(8)];
  1035.          }
  1036.          if(random(60) == 0)
  1037.          {
  1038.             this.dirX = this.dirY = "";
  1039.             this.f2 = "";
  1040.          }
  1041.          else if(random(45) == 0)
  1042.          {
  1043.             this.endSeqMove();
  1044.          }
  1045.       }
  1046.       if(this.control)
  1047.       {
  1048.          if(Key.isDown(_root.moveU))
  1049.          {
  1050.             this.tY = this.y - this.speed;
  1051.             this.handState = "FU";
  1052.          }
  1053.          if(Key.isDown(_root.moveD))
  1054.          {
  1055.             this.tY = this.y + this.speed;
  1056.             this.handState = "BD";
  1057.          }
  1058.          if(Key.isDown(_root.moveL))
  1059.          {
  1060.             this.tX = this.x - this.speed;
  1061.             this.handState = this.facing != "R" ? "FU" : "BD";
  1062.          }
  1063.          if(Key.isDown(_root.moveR))
  1064.          {
  1065.             this.tX = this.x + this.speed;
  1066.             this.handState = this.facing != "R" ? "BD" : "FU";
  1067.          }
  1068.          if(Key.isDown(_root.fireU))
  1069.          {
  1070.             this.fire = true;
  1071.             this.shotY = this.y - 6;
  1072.             this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
  1073.             this.fireDir = "U";
  1074.          }
  1075.          else if(Key.isDown(_root.fireD))
  1076.          {
  1077.             this.fire = true;
  1078.             this.shotY = this.y + 42;
  1079.             this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
  1080.             this.fireDir = "D";
  1081.          }
  1082.          else if(Key.isDown(_root.fireL))
  1083.          {
  1084.             this.fire = true;
  1085.             this.shotX = this.x - 6;
  1086.             this.shotY = this.y + 33;
  1087.             this.fireDir = this.facing = "L";
  1088.          }
  1089.          else if(Key.isDown(_root.fireR))
  1090.          {
  1091.             this.fire = true;
  1092.             this.shotX = this.x + 39;
  1093.             this.shotY = this.y + 33;
  1094.             this.fireDir = this.facing = "R";
  1095.          }
  1096.          else
  1097.          {
  1098.             this.fire = false;
  1099.             this.fireDir = this.facing != "R" ? "L" : "R";
  1100.             this.clip.gotoAndStop("face" + this.facing + "fire" + this.fireDir);
  1101.             this.fc = this.fc + 1;
  1102.          }
  1103.          if(!this.gesture)
  1104.          {
  1105.             this.clip.body.gotoAndStop(this.handState);
  1106.          }
  1107.       }
  1108.       else
  1109.       {
  1110.          if(this.dirY == "U")
  1111.          {
  1112.             this.tY = this.y - this.speed;
  1113.             this.handState = "FU";
  1114.          }
  1115.          if(this.dirY == "D")
  1116.          {
  1117.             this.tY = this.y + this.speed;
  1118.             this.handState = "BD";
  1119.          }
  1120.          if(this.dirX == "L")
  1121.          {
  1122.             this.tX = this.x - this.speed;
  1123.             this.handState = this.facing != "R" ? "FU" : "BD";
  1124.          }
  1125.          if(this.dirX == "R")
  1126.          {
  1127.             this.tX = this.x + this.speed;
  1128.             this.handState = this.facing != "R" ? "BD" : "FU";
  1129.          }
  1130.          if(this.fireDir == "U")
  1131.          {
  1132.             this.fire = true;
  1133.             this.shotY = this.y - 6;
  1134.             this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
  1135.          }
  1136.          else if(this.fireDir == "D")
  1137.          {
  1138.             this.fire = true;
  1139.             this.shotY = this.y + 42;
  1140.             this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
  1141.          }
  1142.          else if(this.fireDir == "L")
  1143.          {
  1144.             this.fire = true;
  1145.             this.shotX = this.x - 6;
  1146.             this.shotY = this.y + 33;
  1147.             this.facing = "L";
  1148.          }
  1149.          else if(this.fireDir == "R")
  1150.          {
  1151.             this.fire = true;
  1152.             this.shotX = this.x + 39;
  1153.             this.shotY = this.y + 33;
  1154.             this.facing = "R";
  1155.          }
  1156.          else
  1157.          {
  1158.             this.fire = false;
  1159.             var _loc3_ = this.facing != "R" ? "L" : "R";
  1160.             this.clip.gotoAndStop("face" + this.facing + "fire" + _loc3_);
  1161.             this.fc = this.fc + 1;
  1162.          }
  1163.          if(this.facing != "switch" && !this.gesture)
  1164.          {
  1165.             this.clip.body.gotoAndStop(this.handState);
  1166.          }
  1167.       }
  1168.       if(this.colorVars.flashing)
  1169.       {
  1170.          this.colorVars.c = this.colorVars.c + 1;
  1171.          this.colorTrans.redOffset = this.colorVars.r - this.colorVars.c * (this.colorVars.r / this.colorVars.cMax);
  1172.          this.colorTrans.greenOffset = this.colorVars.g - this.colorVars.c * (this.colorVars.g / this.colorVars.cMax);
  1173.          this.colorTrans.blueOffset = this.colorVars.b - this.colorVars.c * (this.colorVars.b / this.colorVars.cMax);
  1174.          if(this.colorVars.c >= this.colorVars.cMax)
  1175.          {
  1176.             this.colorVars.flashing = false;
  1177.             this.colorTrans.redOffset = 0;
  1178.             this.colorTrans.greenOffset = 0;
  1179.             this.colorTrans.blueOffset = 0;
  1180.          }
  1181.          this.trans.colorTransform = this.colorTrans;
  1182.       }
  1183.       if(!this.exit)
  1184.       {
  1185.          if(this.tX < 35)
  1186.          {
  1187.             this.tX = 35;
  1188.          }
  1189.          if(this.tX > 965 - this.w)
  1190.          {
  1191.             this.tX = 965 - this.w;
  1192.          }
  1193.          if(this.tY < 35)
  1194.          {
  1195.             this.tY = 35;
  1196.          }
  1197.          if(this.tY > 565 - this.h)
  1198.          {
  1199.             this.tY = 565 - this.h;
  1200.          }
  1201.       }
  1202.       else if(this.x > 1050 || this.x < -50 || this.y < -50 || this.y > 650)
  1203.       {
  1204.          if(this.tagTeaming)
  1205.          {
  1206.             _root.rescue = false;
  1207.          }
  1208.          _root.removeChar("broShip1");
  1209.          _root.bgWait.activateBro();
  1210.          if(_root.lastBoss && !_root.bgWaiting && this.bg)
  1211.          {
  1212.             _root.tagTeam([-50,280,"R"]);
  1213.          }
  1214.       }
  1215.       if(this.fire)
  1216.       {
  1217.          this.clip.gotoAndStop("face" + this.facing + "fire" + this.fireDir);
  1218.          if(this.fc <= this.ofc)
  1219.          {
  1220.             this.fc = this.ofc + 1;
  1221.          }
  1222.          else
  1223.          {
  1224.             this.fc = this.fc + 1;
  1225.          }
  1226.          if(this.fc > this.fireFreq)
  1227.          {
  1228.             this.fc = 0;
  1229.             this["fire_" + this.weapon]();
  1230.          }
  1231.          this.ofc = this.fc;
  1232.       }
  1233.       if(this.tagTeaming)
  1234.       {
  1235.          _root.c = _root.c - 1;
  1236.          if(this.clip.hitTest(_root[_root.char + "Clip"]))
  1237.          {
  1238.             if(_root[_root.char].f2 != "dying")
  1239.             {
  1240.                _root.audio.playLevel2("tagTeam1",20);
  1241.                this.speed = this.baseSpeed;
  1242.                this.control = true;
  1243.                this.exit = false;
  1244.                this.weapon = _root.bro1Weapon = _root.bro2Weapon;
  1245.                this[this.weapon]();
  1246.                this.inv = false;
  1247.                this.tagTeaming = false;
  1248.                _root.rescue = false;
  1249.                _root.char2 = _root.char;
  1250.                _root.char = "broShip1";
  1251.                _root.shield.tagTeam();
  1252.                _root.bro2Life = _root[_root.char2].life;
  1253.                _root[_root.char2].control = false;
  1254.                _root[_root.char2].inv = true;
  1255.                _root[_root.char2].exit = true;
  1256.                _root[_root.char2].fireDir = "";
  1257.                if(this.facing == "R")
  1258.                {
  1259.                   _root[_root.char2].facing = "R";
  1260.                   _root[_root.char2].gotoXY(1300,0,"",true);
  1261.                }
  1262.                else
  1263.                {
  1264.                   _root[_root.char2].facing = "L";
  1265.                   _root[_root.char2].gotoXY(-300,0,"",true);
  1266.                }
  1267.             }
  1268.          }
  1269.       }
  1270.       this.tX += this.xA;
  1271.       this.tY = !this.hover ? this.tY + this.yA : this.tY + this.yA + 0.3 * Math.sin(this.hc += 0.05);
  1272.       this.x = this.tX;
  1273.       this.y = this.tY;
  1274.       this.clip._x = this.x;
  1275.       this.clip._y = this.y;
  1276.    }
  1277. }
  1278.